package com.hyper_yang._03_designpatterns.principles.demo3.next;

/**
 * projectName: com.hyper_yang._03_designpatterns.principles.demo3.next
 *
 * @author: sakiko
 * time: 2025/9/26 21:45
 * description: 依赖倒置原则 【面向接口编程而不是实现类】
 */
public class Test {
    public static void main(String[] args) {
        // 获取组件
        XiJieHardDisk xiJieHardDisk = new XiJieHardDisk();
//        IntelCpu intelCpu = new IntelCpu();
        // 组件更换更轻松 【符合开闭原则】
        AmdCpu amdCpu = new AmdCpu();
        KingstonMemory kingstonMemory = new KingstonMemory();
        // 组装电脑
        Computer computer = new Computer();
        computer.setHardDisk(xiJieHardDisk);
        computer.setCpu(amdCpu);
        computer.setMemory(kingstonMemory);
        computer.run();
    }
}
